/**
 * 客户资料维护
 * @author miaoyl
 * @date 2018/01/14
 */
define(function () {

    var self,
        doc = document,
        app = win.app,
        layui = win.layui,
        element,
        table,
        table_head_where = {},
        table_detail_where = {
            gwal001: ''
        },
        cols = [[
            {type: 'checkbox', fixed: 'left'},
            {field: 'GWAK001', width: 160, title: '交易对象资料编号', fixed: 'left', sort: true,
                search: 'default',searchOpts: {icon:true}}
            , {
                field: 'GWAK002',
                width: 140,
                title: '交易对象类型',
                filterDatas: app.datas_('crm_gwai300_gwak002')
            }
            , {field: 'GWAKL003', width: 160, title: '交易对象简称', sort:true, search: 'default'}
            , {field: 'GWAKL004', width: 160, title: '交易对象全称'}
            , {field: 'GWAKL005', width: 80, title: '助记码'}
            , {
                field: 'GWAK006',
                width: 120,
                title: '交易对象分类',
                filterDatas: app.datas_('crm_gwai300_gwak006')
            }
            , {field: 'GWAK007', width: 150, title: '税号'}
            , {field: 'GWAK008', width: 60, title: '币别'}
            , {field: 'GWAFL003', width: 100, title: '客户分类', sort: true}
            , {field: 'GWAEL003', width: 100, title: '客户渠道', sort: true, search: 'default', searchOpts: {icon: true}}
            , {field: 'GWAK050', width: 100, title: '负责人', search: 'default'}
            , {field: 'GWAK051', width: 80, title: '注册资本'}
            , {field: 'GWAK052', width: 80, title: '年营收'}
            , {field: 'GWAK053', width: 100, title: '负责人电话'}
            //, {field: 'GWAGL003', width: 100, title: '行业分类'}
            , {field: 'GWAQL003', width: 100, title: '客户等级', sort: true}
            , {field: 'GWASL003', width: 100, title: '默认仓库', sort: true}
            //, {field: 'GWAK056', width: 60, title: '折扣率'}
            //, {field: 'GWARL003', width: 100, title: '客户生命周期'}
            // , {field: 'GWAK017', width: 100, title: '线人姓名'}
            // , {field: 'GWAK018', width: 100, title: '线人手机号'}
            // , {field: 'GWAK019', width: 100, title: '线人微信'}
            , {field: 'GWAK055', width: 160, title: '备注'}
            , {field: 'GWAKACTI', width: 60, title: '状态', filterDatas: app.datas_('crm_gwai300_gwakacti'),
                search: 'default', searchOpts: {type: 'select'}},
            {
                width: 60,
                title: '',
                toolbar: '#script-gwai300setting',
                fixed: 'right',
                align: 'center',
                unresize: true
            }
        ]],
        gwai300SettingAction,

        detail_cols = [[
            {type: 'checkbox', fixed: 'left'},
            {field: 'GWAL001', width: 160, title: '交易对象资料编号', fixed: 'left'}
            , {field: 'GWAL002', width: 60, title: '序号'}
            , {field: 'GWAL003', width: 100, title: '地址类型', filterDatas: app.datas_('crm_gwai300_gwal003')}
            , {field: 'GWAL021', width: 120, title: '联系人'}
            , {field: 'GWAL020', width: 100, title: '电话'}
            , {field: 'GWAL019', width: 100, title: '邮编'}
            // , {field: 'NAME010', width: 80, title: '洲别'}
            // , {field: 'NAME011', width: 60, title: '国别'}
            // , {field: 'NAME012', width: 80, title: '区域'}
            , {field: 'NAME013', width: 80, title: '省'}
            , {field: 'NAME014', width: 80, title: '市'}
            , {field: 'NAME015', width: 80, title: '县/区'}
            , {field: 'NAME016', width: 80, title: '乡/镇'}
            , {field: 'NAME017', width: 80, title: '街道/村'}
            , {field: 'GWAL018', width: 100, title: '详细地址'}
            , {field: 'GWALACTI', width: 60, title: '有效否', filterDatas: app.datas_('sys_y_n')},
            {
                width: 60,
                title: '',
                toolbar: '#script-gwai300detailsetting',
                fixed: 'right',
                align: 'center',
                unresize: true
            }
        ]],
        gwai300DetailSettingAction
    ;

    var Gwai300 = app.Module.extend({
        init: function () {
            self = this;
            self._super({
                _tag: 'gwai300',
                _searchs: [{
                    id: 'gwai300', tableId: 'gwai300_table', datas: cols[0]
                }],
                _loadTplsFull: [
                    {
                        dom: 'gwai300_edit', tpl: 'gwai300_edit'
                    },
                    {
                        dom: 'gwai300_detail_edit', tpl: 'gwai300_detail_edit'
                    },
                    {
                        dom: 'gwai300_syncERP', tpl: 'gwai300_syncERP'
                    },
                    {
                        dom: 'common_open_window', tpl: 'common/_open_window'
                    },
                    {
                        dom: 'gwai300_edit_gwak088', tpl: 'gwai300_edit_gwak088'
                    }
                ]
            }, win);
        },

        initHeadTable: function () {
            layui.use(['table'], function () {
                table = layui.table;
                table.render({
                    elem: app.getByid(doc, 'gwai300_table'),
                    url: g_ctxPath + 'crm/gwai300/getHeadlist',
                    exportsUrl: g_ctxPath + 'crm/gwai300/getHeadlist',
                    exportsName: '客户数据',
                    title: '客户信息表',
                    method: 'post',
                    id: 'gwai300_table',
                    size: _layuiConfig.ui_size,
                    autoSort: false, //禁用前端自动排序
                    toolbar: '#table-toolbar',
                    defaultToolbar: ['filter', 'exports'],
                    height: 'full',
                    cols: cols,
                    loading: true,
                    page: true,
                    where: table_head_where,
                    done: function (res, curr, count) {

                    }
                });

                layui.laytpl(app.getByid(doc, 'script-gwai300setting-action').innerHTML).render({}, function (string) {
                    gwai300SettingAction = string;
                });

                var tipsIndex = null;

                table.on('tool(gwai300_table)', function (obj) {

                    layer.tips(gwai300SettingAction, obj.td, {
                        tips: [3, '']
                        , time: 3000
                        , anim: 500
                        , maxWidth: 120
                        , skin: 'layui-table-tips'
                        , success: function (layero, index) {
                            layero.find('li').on('click', function () {
                                switch ($(this).attr('inx')) {
                                    case '0':
                                        if(obj.data.GWAKACTI != 'Y' && obj.data.GWAKACTI != 'N' && obj.data.GWAKACTI != 'R'){
                                            app.showWarning("只有Y:有效、N:无效、R:退回状态可以修改！");
                                            return;
                                        }
                                        self._openTplFull({
                                            tag: 'gwai300_edit',
                                            tagData: {
                                                obj:obj
                                            },
                                            index: 0,
                                            openOpts: {
                                                title: '客户信息编辑',
                                                maxmin: true
                                            }
                                        });
                                        break;
                                    case '1':
                                        if(obj.data.GWAKACTI != 'Y' && obj.data.GWAKACTI != 'N' && obj.data.GWAKACTI != 'R'){
                                            app.showWarning("只有Y:有效、N:无效、R:退回状态可以删除！");
                                            return;
                                        }
                                        self.delData(obj);
                                        break;
                                    case '2':
                                        if(obj.data.GWAKACTI != 'Y' && obj.data.GWAKACTI != 'N' && obj.data.GWAKACTI != 'R'){
                                            app.showWarning("只有Y:有效、N:无效、R:退回状态可以修改！");
                                            return;
                                        }
                                        self._openTplFull({
                                            tag: 'gwai300_edit',
                                            tagData: {
                                                obj: obj,
                                                is_rules:true
                                            },
                                            index: 0,
                                            openOpts: {
                                                title: '客户信息编辑',
                                                maxmin: true
                                            }
                                        });
                                        break;
                                }
                                layer.close(index);
                            });
                        }
                    });
                });

                //监听行单击事件
                table.on('row(gwai300_table)', function (obj) {
                    table_detail_where.gwal001 = obj.data.GWAK001;
                    obj.tr.addClass('layui-table-click').siblings().removeClass('layui-table-click');
                    self.reloadDetailTableCurr();
                });

                //监听行双击事件
                table.on('rowDouble(gwai300_table)', function (obj) {
                    self._openTplFull({
                        tag: 'gwai300_edit',
                        tagData:{
                            obj: obj,
                            is_detail:true
                        },
                        index: 0,
                        openOpts: {
                            title: '客户信息编辑',
                            maxmin: true
                        }
                    });
                });

                //监听事件
                table.on('toolbar(gwai300_table)', function (obj) {
                    switch (obj.event) {
                        case 'add':
                            self._openTplFull({
                                tag: 'gwai300_edit',
                                tagData: {
                                    is_add: true
                                },
                                index: 0,
                                openOpts: {
                                    title: '客户信息编辑',
                                    maxmin: true
                                }
                            });
                            break;
                        case 'del':
                            app.confirm({
                                msg: '是否删除选择的数据？',
                                ok: function () {
                                    self.delDataBatch();
                                }
                            });
                            break;
                        case 'sync':
                            var checkStatus = table.checkStatus('gwai300_table');
                            if (checkStatus.data.length > 0) {
                                var _xdata = [];
                                checkStatus.data.forEach(function (v) {
                                    _xdata.push(v.GWAK001);
                                });
                                self._openTplFull({
                                    tag: 'gwai300_syncERP',
                                    tagData: {
                                        gwak001_list: _xdata
                                    },
                                    index: 2,
                                    openOpts: {
                                        title: '同步ERP',
                                        area: ['400px', '430px']
                                    }
                                });
                            } else {
                                app.showWarning('请先选择数据！');
                                return;
                            }
                            break;
                        case 'valid' :
                            self.valid();
                            break;
                        case 'invalid' :
                            self.invalid();
                            break;
                        case 'commit' :
                            self.commit();
                            break;
                        case 'unCommit' :
                            self.unCommit();
                            break;
                        case 'confirm' :
                            self.confirm();
                            break;
                        case 'revoke' :
                            self.revoke();
                            break;
                        case 'changeRequest' :
                            self.changeRequest();
                            break;
                    }
                });

                $(doc).on('click', function () {
                    tipsIndex && layer.close(tipsIndex);
                });

            });
        },

        initDetailTable: function () {
            layui.use(['table'], function () {
                table = layui.table;
                table.render({
                    elem: app.getByid(doc, 'gwai300_detail_table'),
                    url: g_ctxPath + 'crm/gwai300/getDetailList',
                    exportsUrl: g_ctxPath + 'crm/gwai300/getDetailList',
                    exportsName: '客户联系人数据',
                    title: '客户联系人信息表',
                    method: 'post',
                    id: 'gwai300_detail_table',
                    size: _layuiConfig.ui_size,
                    autoSort: false, //禁用前端自动排序
                    toolbar: '#detail-table-toolbar',
                    defaultToolbar: ['filter', 'exports'],
                    height: 'full-10',
                    cols: detail_cols,
                    page: true,
                    where: '',
                    done: function (res, curr, count) {

                    }
                });

                layui.laytpl(app.getByid(doc, 'script-gwai300detailsetting-action').innerHTML).render({}, function (string) {
                    gwai300DetailSettingAction = string;
                });

                var tipsIndex = null;

                table.on('tool(gwai300_detail_table)', function (obj) {
                    layer.tips(gwai300DetailSettingAction, obj.td, {
                        tips: [3, '']
                        , time: 3000
                        , anim: 500
                        , maxWidth: 120
                        , skin: 'layui-table-tips'
                        , success: function (layero, index) {
                            layero.find('li').on('click', function () {
                                switch ($(this).attr('inx')) {
                                    case '0':
                                        self._openTplFull({
                                            tag: 'gwai300_detail_edit',
                                            tagData: {
                                                obj: obj,
                                                pageName: 'gwai300'
                                            },
                                            index: 1,
                                            openOpts: {
                                                title: '客户联系人信息编辑',
                                                maxmin: true
                                            }
                                        });
                                        break;
                                    case '1':
                                        self.delDetailData(obj);
                                        break;
                                }
                                layer.close(index);
                            });
                        }
                    });
                });

                //监听行双击事件
                table.on('rowDouble(gwai300_detail_table)', function (obj) {
                    self._openTplFull({
                        tag: 'gwai300_detail_edit',
                        tagData: {
                            obj: obj,
                            pageName: 'gwai300',
                            is_detail: true
                        },
                        index: 1,
                        openOpts: {
                            title: '客户联系人编辑',
                            maxmin: true
                        }
                    });
                });

                //监听事件
                table.on('toolbar(gwai300_detail_table)', function (obj) {
                    switch (obj.event) {
                        case 'add':
                            if (table_detail_where.gwal001 == '') {
                                app.showError('未选择客户信息，请先选择！');
                                return;
                            }
                            self.addDetailData();
                            break;
                        case 'del':
                            app.confirm({
                                msg: '是否删除选择的数据？',
                                ok: function () {
                                    self.delDetailDataBatch();
                                }
                            });
                            break;
                    }
                });

                $(doc).on('click', function () {
                    tipsIndex && layer.close(tipsIndex);
                });

            });
        },

        reloadTableCurr: function () {
            self._reloadTable({id: 'gwai300_table', where: table_head_where});
        },

        reloadDetailTableCurr: function () {
            self._reloadTable({id: 'gwai300_detail_table', where: table_detail_where});
        },

        delData: function (obj) {
            app.confirm({
                msg: '是否删除选择的信息？',
                ok: function () {
                    app.ajax({
                        xurl: 'crm/gwai300/del',
                        xdata: obj.data,
                        loading: true,
                        okmsg: '客户信息删除成功',
                        cb: function (result) {
                            if (result.ok) {
                                self.reloadTableCurr();
                            }
                        }
                    });
                }
            });

        },

        delDataBatch: function () {
            var checkStatus = table.checkStatus('gwai300_table');
            if (checkStatus.data.length > 0) {
                var _xdata = [];
                checkStatus.data.forEach(function (v) {
                    var _temp = app.fields_('crm_gwai300');
                    _temp.GWAK001 = v.GWAK001;
                    _temp.GWAKENT = v.GWAKENT;
                    _xdata.push(_temp);
                });
                app.ajax({
                    xurl: 'crm/gwai300/delDataBatch',
                    xdata: _xdata,
                    loading: true,
                    toJsonStr: true,
                    okmsg: '客户信息删除成功',
                    cb: function (result) {
                        if (result.ok) {
                            self.reloadTableCurr();
                        }
                    }
                });
            }
        },

        delDetailData: function (obj) {
            app.confirm({
                msg: '是否删除选择的信息？',
                ok: function () {
                    app.ajax({
                        xurl: 'crm/gwai300/delDetail',
                        xdata: obj.data,
                        loading: true,
                        okmsg: '客户联系人信息删除成功',
                        cb: function (result) {
                            if (result.ok) {
                                self.reloadDetailTableCurr();
                            }
                        }
                    });
                }
            });

        },

        delDetailDataBatch: function () {
            var checkStatus = table.checkStatus('gwai300_detail_table');
            if (checkStatus.data.length > 0) {
                var _xdata = [];
                checkStatus.data.forEach(function (v) {
                    var _temp = app.fields_('crm_gwai300_detail');
                    _temp.GWAL002 = v.GWAL002;
                    _temp.GWAL001 = v.GWAL001;
                    _temp.GWALENT = v.GWALENT;
                    _xdata.push(_temp);
                });
                app.ajax({
                    xurl: 'crm/gwai300/delDetailDataBatch',
                    xdata: _xdata,
                    loading: true,
                    toJsonStr: true,
                    okmsg: '客户联系人信息删除成功',
                    cb: function (result) {
                        if (result.ok) {
                            self.reloadDetailTableCurr();
                        }
                    }
                });
            }
        },

        addDetailData: function () {
            app.ajax({
                xurl: 'crm/gwai300/getMaxGwal002',
                xdata: {GWAL001: table_detail_where.gwal001},
                cb: function (result) {
                    var data = 1;
                    if (result.data.data != '') {
                        data = result.data.data;
                    }
                    self._openTplFull({
                        tag: 'gwai300_detail_edit',
                        tagData: {
                            is_add: true,
                            pageName: 'gwai300',
                            gwal001: table_detail_where.gwal001,
                            gwal002: data
                        },
                        index: 1,
                        openOpts: {
                            title: '客户联系人编辑',
                            maxmin: true
                        }
                    });
                }
            });
        },

        valid: function () {
            var flag = true;
            var checkStatus = table.checkStatus('gwai300_table');
            if (checkStatus.data.length > 0) {
                var _xdata = [];
                checkStatus.data.forEach(function (v) {
                    var _temp = app.fields_('crm_gwai300');
                    if (v.GWAKACTI != 'N') {
                        app.showWarning("只有状态为N：无效的客户信息才可以进行有效操作！");
                        flag = false;
                        return;
                    } else {
                        _temp.GWAKENT = v.GWAKENT;
                        _temp.GWAK001 = v.GWAK001;
                        _temp.GWAKACTI = "Y";
                        _xdata.push(_temp);
                    }
                });
            } else {
                app.showWarning("请先选择数据！");
                return;
            }
            if (flag) {
                app.confirm({
                    msg: '是否有效选择的数据？',
                    ok: function () {
                        app.ajax({
                            xurl: 'crm/gwai300/updateStatus',
                            xdata: _xdata,
                            loading: true,
                            toJsonStr: true,
                            okmsg: '客户信息有效成功',
                            cb: function (result) {
                                if (result.ok) {
                                    self.reloadTableCurr();
                                }
                            }
                        });
                    }
                });
            }
        },

        invalid: function () {
            var flag = true;
            var checkStatus = table.checkStatus('gwai300_table');
            if (checkStatus.data.length > 0) {
                var _xdata = [];
                checkStatus.data.forEach(function (v) {
                    var _temp = app.fields_('crm_gwai300');
                    if (v.GWAKACTI != 'Y') {
                        app.showWarning("只有状态为Y：有效的客户信息才可以进行无效操作！");
                        flag = false;
                        return;
                    } else {
                        _temp.GWAKENT = v.GWAKENT;
                        _temp.GWAK001 = v.GWAK001;
                        _temp.GWAKACTI = "N";
                        _xdata.push(_temp);
                    }
                });
            } else {
                app.showWarning("请先选择数据！");
                return;
            }
            if (flag) {
                app.confirm({
                    msg: '是否无效选择的数据？',
                    ok: function () {
                        app.ajax({
                            xurl: 'crm/gwai300/updateStatus',
                            xdata: _xdata,
                            loading: true,
                            toJsonStr: true,
                            okmsg: '客户信息无效成功',
                            cb: function (result) {
                                if (result.ok) {
                                    self.reloadTableCurr();
                                }
                            }
                        });
                    }
                });
            }
        },

        commit: function () {//业务提交
            var flag = true;
            var checkStatus = table.checkStatus('gwai300_table');
            if (checkStatus.data.length > 0) {
                var _xdata = [];
                checkStatus.data.forEach(function (v) {
                    if (v.GWAKACTI != 'Y' && v.GWAKACTI != 'N' && v.GWAKACTI != 'R') {
                        app.showWarning("只有状态为Y:有效、N:无效、R:退回的客户信息才可以进行提交操作！");
                        flag = false;
                        return;
                    }else {
                        var _temp = app.fields_('crm_gwai300');
                        _temp.GWAKENT = v.GWAKENT;
                        _temp.GWAK001 = v.GWAK001;
                        _temp.GWAKACTI = "T";
                        _xdata.push(_temp);
                    }
                });
            } else {
                app.showWarning("请先选择数据！");
                return;
            }
            if (flag) {
                app.confirm({
                    msg: '是否提交选择的数据？',
                    ok: function () {
                        app.ajax({
                            xurl: 'crm/gwai300/updateStatus',
                            xdata: _xdata,
                            loading: true,
                            toJsonStr: true,
                            okmsg: '客户信息提交成功',
                            cb: function (result) {
                                if (result.ok) {
                                    self.reloadTableCurr();
                                }
                            }
                        });
                    }
                });
            }
        },

        unCommit: function () {
            var flag = true;
            var checkStatus = table.checkStatus('gwai300_table');
            if (checkStatus.data.length > 0) {
                var _xdata = [];
                checkStatus.data.forEach(function (v) {
                    var _temp = app.fields_('crm_gwai300');
                    if (v.GWAKACTI != 'T') {
                        app.showWarning("只有状态为T：提交的客户信息才可以进行取消提交操作！");
                        flag = false;
                        return;
                    } else {
                        _temp.GWAKENT = v.GWAKENT;
                        _temp.GWAK001 = v.GWAK001;
                        _temp.GWAKACTI = "Y";
                        _xdata.push(_temp);
                    }
                });
            } else {
                app.showWarning("请先选择数据！");
                return;
            }
            if (flag) {
                app.confirm({
                    msg: '是否取消提交选择的数据？',
                    ok: function () {
                        app.ajax({
                            xurl: 'crm/gwai300/updateStatus',
                            xdata: _xdata,
                            loading: true,
                            toJsonStr: true,
                            okmsg: '客户信息取消提交成功',
                            cb: function (result) {
                                if (result.ok) {
                                    self.reloadTableCurr();
                                }
                            }
                        });
                    }
                });
            }
        },

        confirm: function () {//规划部确认
            var flag = true;
            var checkStatus = table.checkStatus('gwai300_table');
            if (checkStatus.data.length > 0) {
                var _xdata = [];
                checkStatus.data.forEach(function (v) {
                    if (v.GWAKACTI != 'T') {
                        app.showWarning("只有状态为T:提交的信息才可以进行确认！");
                        flag = false;
                        return;
                    }else {
                        var _temp = app.fields_('crm_gwai300');
                        _temp.GWAKENT = v.GWAKENT;
                        _temp.GWAK001 = v.GWAK001;
                        _temp.GWAKACTI = "F";
                        _xdata.push(_temp);
                    }
                });
            } else {
                app.showWarning("请先选择数据！");
                return;
            }
            if (flag) {
                app.confirm({
                    msg: '是否确认选择的数据？',
                    ok: function () {
                        app.ajax({
                            xurl: 'crm/gwai300/updateStatus',
                            xdata: _xdata,
                            loading: true,
                            toJsonStr: true,
                            okmsg: '客户信息确认成功',
                            cb: function (result) {
                                if (result.ok) {
                                    self.reloadTableCurr();
                                }
                            }
                        });
                    }
                });
            }
        },

        revoke: function () { //退回
            var flag = true;
            var checkStatus = table.checkStatus('gwai300_table');
            if (checkStatus.data.length > 0) {
                var _xdata = [];
                checkStatus.data.forEach(function (v) {
                    var _temp = app.fields_('crm_gwai300');
                    if (v.GWAKACTI != 'T') {
                        app.showWarning("只有状态为T：提交的信息才可以进行退回操作！");
                        flag = false;
                        return;
                    } else {
                        _temp.GWAKENT = v.GWAKENT;
                        _temp.GWAK001 = v.GWAK001;
                        _temp.GWAKACTI = "R";
                        _xdata.push(_temp);
                    }
                });
            } else {
                app.showWarning("请先选择数据！");
                return;
            }
            if (flag) {
                self._openTplFull({
                    tag: 'gwai300_edit_gwak088',
                    tagData: {
                        _xdata: _xdata
                    },
                    index: 4,
                    openOpts: {
                        title: '退回意见编辑',
                        area: ['400px', '300px']
                    }
                });
            }
        },

        changeRequest: function () { //变更
            var flag = true;
            var checkStatus = table.checkStatus('gwai300_table');
            if (checkStatus.data.length == 1) {
                var _xdata = [];
                checkStatus.data.forEach(function (v) {
                    var _temp = app.fields_('crm_gwai300');
                    if (v.GWAKACTI != 'F') {
                        app.showWarning("只有状态为F：已确认的信息才可以进行变更申请操作！");
                        flag = false;
                        return;
                    }
                });
            } else if(checkStatus.data.length == 0) {
                app.showWarning("请先选择数据！");
                return;
            }else {
                app.showWarning("仅允许单笔操作！");
                return;
            }
            if (flag) {
                self._openTplFull({
                    tag: 'gwai300_edit',
                    tagData: {
                        obj: {
                            data: checkStatus.data[0]
                        },
                        is_rules:true
                    },
                    index: 0,
                    openOpts: {
                        title: '客户信息编辑',
                        maxmin: true
                    }
                });
            }
        },

        _ready: function () {
            this._super({
                vue: [{
                    el: '#page',
                    data: '',
                    searchId: 'gwai300',
                    methods: {
                        handleIconClick: function (field) {
                            var vue = this;
                            if (field == 'GWAK001') {
                                self._openTplFull({
                                    tag: 'common_open_window',
                                    tagData: {
                                        config: {
                                            method:'q_gwak001',
                                            columnList: [
                                                {label: '客户编号', prop: 'GWAK001', width: '150'},
                                                {label: '客户简称', prop: 'GWAKL003', width: '150'},
                                                {label: '客户全称', prop: 'GWAKL004', width: '150'}
                                            ],
                                        },
                                        cb: function (data) {
                                            vue.isearch.fields.GWAK001 = data.GWAK001;
                                        }
                                    },
                                    index: 3,
                                    openOpts: {
                                        title: '选择客户',
                                        area: ['600px', '465px']
                                    }
                                });
                            } else if (field == 'GWAEL003') {
                                self._openTplFull({
                                    tag: 'common_open_window',
                                    tagData: {
                                        config: {
                                            method:'q_gwae001',
                                            searchParam: {
                                                hasPermission: false
                                            },
                                            columnList: [
                                                {label: '销售渠道编号', prop: 'GWAE001', width: '150'},
                                                {label: '说明', prop: 'GWAEL003', width: '150'},
                                                {label: '助记码', prop: 'GWAEL004', width: '150'},
                                            ],
                                        },
                                        cb: function (data) {
                                            vue.isearch.fields.GWAEL003 = data.GWAEL003;
                                        }
                                    },
                                    index: 3,
                                    openOpts: {
                                        title: '选择销售渠道',
                                        area: ['600px', '465px']
                                    }
                                });
                            }
                        }
                    }
                }]
            });
            self.initHeadTable();
            self.initDetailTable();
        },
        _lazy: function () {
            this._super();
        }
    });

    return new Gwai300();

});